package model.skill;

import model.map.Direction;
import model.map.Location;
import utilities.*;

public class ProjectileInformation implements Archiveable {

	private Location location;
	private Direction direction;
	
	public ProjectileInformation()
	{
		location = new Location();
		direction = Direction.S;
	}
	
	public ProjectileInformation(Location location, Direction direction)
	{
		this.location = location;
		this.direction = direction;
	}
	
	public Location getLocation() {
		return location;
	}

	public void setLocation(Location location) {
		this.location = location;
	}
	
	public Direction getDirection() {
		return direction;
	}

	public void setDirection(Direction direction) {
		this.direction = direction;
	}
	
	public Archive save() {
		Archive archive = ArchiveFactory.createArchive();
		
		archive.putClassName("location", this.location.getClass().getName());
		archive.putOneRelationship("location", this.location);
		
		return archive;
	}
	
	public void load(Archive archive) {
		this.location = (Location)ModelFactory.getInstance().createInstanceWithClassName(archive.getClassName("location"));
		this.location.load(archive.getOneRelationship("location"));
	}
}
